package org.hhchat.others.toutiao.p2017;


import java.util.*;

/**
 * Created by HMH on 2017/3/30.
 */
public class toutiao03 {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String kuohao = scanner.next();
        int MaxDeep = 0;
        List<Integer> draw = new ArrayList<>();
        int deep=0;
        Stack<Character> stack = new Stack<>();
        boolean isup=true;
        for(int i=0;i<kuohao.length();i++) {
            if (kuohao.charAt(i) == '[') {
                if (stack.size() == 0) {
                    draw.add(-1);
                }
                stack.push('[');
                isup=true;
                if (stack.size() == 0) {
                    draw.add(-1);
                }
                draw.add(stack.size());
                MaxDeep = MaxDeep < stack.size() ? stack.size() : MaxDeep;
            }
            else {
                if (isup == true) {
                    draw.add(0);
                    isup = false;
                }
                draw.add(stack.size());
                stack.pop();
                if (stack.size() == 0) {
                    draw.add(-1);
                }
            }
        }
        System.out.println(draw);
        System.out.println(MaxDeep);
        print(draw, MaxDeep);
    }

    public static void print(List<Integer> draw,int deep) {
        int len = deep*2+1;
        List<char[]> list = new ArrayList<>();
        for(int i=0;i<draw.size();i++) {
            char[] temp = new char[len];
            Arrays.fill(temp,' ');
            if (draw.get(i) == -1) {
                if(draw.get(i)==-1){
                    temp[0]='+';
                    temp[len-1]='+';
                    for(int j=1;j<len-1;j++) {
                        temp[j] = '-';
                    }
                }
                list.add(temp);
            }
            else if (draw.get(i) == 0) {
                list.add(temp);
            }
            else{
                int value = draw.get(i);
                temp[value-1]='|';
                temp[len - value] = '|';
                char[] last = list.get(list.size() - 1);
                if (draw.get(i - 1) > 0 && draw.get(i-1)<value) {
                    last[value - 1] = '+';
                    last[len-value] = '+';
                    for(int j = value;j<len-value;j++) {
                        last[j] = '-';
                    }
                } else if (draw.get(i - 1) > 0 && draw.get(i - 1) > value) {
                    temp[value - 1+1] = '+';
                    temp[len-value-1] = '+';
                    for(int j = value+1;j<len-value-1;j++) {
                        temp[j] = '-';
                    }
                }
                list.add(temp);
            }
        }

        for(int i=0;i<list.size();i++) {
            System.out.println(new String(list.get(i)));
        }
    }
}
